window.onload = function () {
    var id = getUrlQueryString('index');
    $("#tno").attr("value",id);
    var telephone = $("#telephone").attr("value");
    var email = $("#email").attr("value");
    function getUrlQueryString(names, urls) {
        urls = urls || window.location.href;
        urls && urls.indexOf("?") > -1 ? urls = urls
            .substring(urls.indexOf("?") + 1) : "";
        var reg = new RegExp("(^|&)" + names + "=([^&]*)(&|$)", "i");
        var r = urls ? urls.match(reg) : window.location.search.substr(1)
            .match(reg);
        if (r != null && r[2] != "")
            return unescape(r[2]);
        return null;
    };

    $("#btn").click(function () {
        var tname = $("#tname").val();
        var tno = $("#tno").val();
        var sex = $("#sex").val();
        var age = $("#age").val();
        var telephone = $("#telephone").val();
        var email = $("#email").val();
        $.ajax({
            url:"/RuanJianKeShe/updateTeacherInfo",
            type:"post",
            data:{
                "msg":"updateTeacherInfo",
                "tname":tname,
                "tno":tno,
                "sex":sex,
                "age": age,
                "telephone":telephone,
                "email":email
            },
            dataType:"json",
            success:function(success){
                alert(success)
            },
            error:function(){
                alert("fail");
            }
        })
        window.history.back();
    })
}



